{{ define "admin/role/auth.html" }}
{{ template "admin/common/page_header.html" .}}

<div class="col-lg-12">
    <div class="card">
        <div class="card-header"><h4>【{{.roleName}}】-设置权限</h4></div>
        <div class="card-body">
            <form action="/admin/role/doAuth" method="post">
                <input type="hidden" name="role_id" value="{{.roleId}}" />
                <table class="table table-striped">
                    <thead>
                        <tr>
                            <th>
                                <div class="custom-control custom-checkbox">
                                    <input type="checkbox" class="custom-control-input" id="check-all">
                                    <label class="custom-control-label" for="check-all">全选</label>
                                </div>
                            </th>
                        </tr>
                    <thead>
                    <tbody>
                        {{range $key,$value := .accessList}}
                            <tr>
                                <td class="p-l-20">
                                    <div class="custom-control custom-checkbox">
                                        <label class="custom-control-label">
                                            <input type="checkbox"
                                                   {{if eq $value.Checked true }}checked{{end}}
                                                   class="custom-control-input checkbox-parent"
                                                   id="roleid-`{{$value.Id}}`" dataid="id-`{{$value.Id}}`"
                                                   value="{{$value.Id}}"
                                                   name="access_node[]">
                                            {{$value.ModuleName}}
                                        </label>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td class="p-l-40">
                                    <div class="row">
                                    {{range $k,$v := $value.AccessItem}}
                                        <div class="custom-control custom-checkbox custom-control-inline .col-md-4">
                                            <input type="checkbox" name="access_node[]"
                                                   {{if eq $v.Checked true }}checked{{end}}
                                                   value="{{$v.Id}}"
                                                   class="custom-control-input checkbox-child" id="roleid-`{{$v.Id}}`" dataid="id-`{{$v.Id}}`" >
                                            <label class="custom-control-label" for="roleid-`{{$v.Id}}`">{{$v.ActionName}} </label>
                                        </div>
                                    {{end}}
                                    </div>
                                </td>
                            </tr>
                        {{end}}
                    </tbody>
                </table>
                <button type="submit" class="btn btn-primary">提交</button>
            </form>
        </div>
    </div>
</div>

{{end}}